# jsb/__init__.py
#
#

""" jsb global module. """

## jsb imports

from jsb.utils.lazydict import LazyDict
from jsb.lib.persist import Persist
from jsb.lib.datadir import getdatadir

# basic imports

import os
import logging

## defines

globals = LazyDict()

## save_globals function

def save_globals():
    p = Persist(getdatadir() + os.sep + "globals")
    p.data = globals
    p.save()
    logging.warn("globals saved")

## load_globals function

def load_globals():
    global globals
    p = Persist(getdatadir() + os.sep + "globals")
    globals.update(p.data)
    logging.warn("globals updated")
